package com.youkeda.yikao.web.dao;

import com.youkeda.yikao.web.dataobject.ChenzikangUesrSystem;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface ChenzikangUesrSystemMapper {
    @Delete({
        "delete from chenzikang_uesr_system",
        "where user = #{user,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String user);

    @Insert({
        "insert into chenzikang_uesr_system (user, pwd, ",
        "gmt_created, gmt_modify, ",
        "prefix, name)",
        "values (#{user,jdbcType=VARCHAR}, #{pwd,jdbcType=VARCHAR}, ",
        "now(), now(), ",
        "#{prefix,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})"
    })
    int insert(ChenzikangUesrSystem record);

    @Select({
        "select",
        "user, pwd, gmt_created, gmt_modify, prefix, name",
        "from chenzikang_uesr_system",
        "where user = #{user,jdbcType=VARCHAR}"
    })
    @Results(id = "resultMap",value = {
        @Result(column="user", property="user", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="pwd", property="pwd", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_created", property="gmtCreated", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modify", property="gmtModify", jdbcType=JdbcType.VARCHAR),
        @Result(column="prefix", property="prefix", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    ChenzikangUesrSystem selectByPrimaryKey(String user);

    @SelectProvider(type = QueryBuilder.class,method = "query")
    @ResultMap("resultMap")
    List<ChenzikangUesrSystem> selectBy(@Param(value = "info") String info,@Param(value = "str") String str);


    @Select({
        "select",
        "user, pwd, gmt_created, gmt_modify, prefix, name",
        "from chenzikang_uesr_system"
    })
    @Results({
        @Result(column="user", property="user", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="pwd", property="pwd", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_created", property="gmtCreated", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modify", property="gmtModify", jdbcType=JdbcType.VARCHAR),
        @Result(column="prefix", property="prefix", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    List<ChenzikangUesrSystem> selectAll();





    @Update({
        "update chenzikang_uesr_system",
        "set pwd = #{pwd,jdbcType=VARCHAR},",
          "gmt_created = #{gmtCreated,jdbcType=TIMESTAMP},",
          "gmt_modify = #{gmtModify,jdbcType=VARCHAR},",
          "prefix = #{prefix,jdbcType=VARCHAR},",
          "name = #{name,jdbcType=VARCHAR}",
        "where user = #{user,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(ChenzikangUesrSystem record);
}